#include <stdio.h>
#include <math.h>

static double get_humidex(double temperature, double dewpoint)
{
    double e = 6.11 * exp(5417.7530 * ((1/273.16) - (1/(dewpoint+273.16))));
    double h = 0.5555 * (e - 10.0);
    return temperature + h;
}

static double get_temperature(double dewpoint, double humidex)
{
    double e = 6.11 * exp(5417.7530 * ((1/273.16) - (1/(dewpoint+273.16))));
    double h = 0.5555 * (e - 10.0);
    return humidex - h;
}

static double get_dewpoint(double humidex, double temperature)
{
    double h = humidex - temperature;
    double e = h / 0.5555 + 10.0;
    double x = log(e / 6.11) / 5417.7530;
    return 1 / (1/273.16-x) - 273.16;
}

int main()
{
    const char *fmt = "T %.1lf D %.1lf H %.1lf\n";
    double v1, v2;
    char t1, t2;
    while (scanf(" %c %lf %c %lf", &t1, &v1, &t2, &v2) == 4 && t1 != 'E')
    {
        if (t1 == 'T' && t2 == 'D')
            printf(fmt, v1, v2, get_humidex(v1, v2));
        else if (t1 == 'D' && t2 == 'T')
            printf(fmt, v2, v1, get_humidex(v2, v1));
        else if (t1 == 'T' && t2 == 'H')
            printf(fmt, v1, get_dewpoint(v2, v1), v2);
        else if (t1 == 'H' && t2 == 'T')
            printf(fmt, v2, get_dewpoint(v1, v2), v1);
        else if (t1 == 'D' && t2 == 'H')
            printf(fmt, get_temperature(v1, v2), v1, v2);
        else if (t1 == 'H' && t2 == 'D')
            printf(fmt, get_temperature(v2, v1), v2, v1);
    }
    return 0;
}